using System;

using Microsoft.SharePoint;

using RealDolmen.Helpers;

namespace RealDolmen.SharePoint.ListFeatures
{
    public class LFDKeyManager : KeyManager
    {
        internal static string KEY_FEATURE = "ListFeature";

        public LFDKeyManager()
            : base('.', KEY_FEATURE)
        {
        }
    }

    public class ListFeatureKeyManager : KeyManager
    {
        protected static string KEY_LIST = "LF";

        public ListFeatureKeyManager()
            : base('.', KEY_LIST)
        {}

        public ListFeatureKeyManager(Guid guid, SPList list)
            : base('.', KEY_LIST)
        {
            Initialize(guid, list);
        }

        public ListFeatureKeyManager(SPList list)
            : base('.', KEY_LIST)
        {
            Initialize(list);
        }

        public void Initialize(Guid guid, SPList list)
        {
            Prefix = GenerateFullString(KEY_LIST, list.ID, guid);
        }

        public void Initialize(SPList list)
        {
            Prefix = base.GenerateFullString(KEY_LIST, list.ID);
        }

        public static string GenerateDottedKey(params object[] list)
        {
            return GenerateFullKey('.', list);
        }
    }
}
